﻿<%@ WebHandler Language="C#" Class="addTechnician" %>

using System;
using System.Web;

using AMCBO;
using AMCOBJ;

public class addTechnician : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        //context.Response.Write("Hello World");
        users obj_user = new users();
        createusers obj_create = new createusers();
        int x;
        if(!string.IsNullOrEmpty(context.Request.QueryString["tName"]))
        {
            obj_user.TechName = context.Request.QueryString["tName"];
        }
        if(!string.IsNullOrEmpty(context.Request.QueryString["tMobile"]))
        {
            obj_user.TechMobile = context.Request.QueryString["tMobile"];
        }
        if(!string.IsNullOrEmpty(context.Request.QueryString["tAddress"]))
        {
            obj_user.TechAddress = context.Request.QueryString["tAddress"];
        }
        HttpCookie oCookieID = (HttpCookie)context.Request.Cookies["username"];
        if (oCookieID.Value != string.Empty)
        {
            obj_user.AdminUser = oCookieID.Value.ToString();
        }
        try
        {
            x = obj_create.insertTechnicians(obj_user);
            if (x == 0)
            {
                context.Response.Write("y");
            }
            else
            {
                context.Response.Write("n");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}